<template>
  <div class="content">
    <div v-html="state.content"></div>
  </div>
</template>

<script>
import { onMounted, reactive } from "vue";
import { getArticle } from "@/api/article";
import { useRoute } from "vue-router";
export default {
  setup() {
    const route = useRoute();

    const state = reactive({
      content: "",
    });
    onMounted(() => {
      getArticleInfo(route.query.id);
    });
    function getArticleInfo(id) {
      getArticle(id).then((res) => {
        state.content = res.data.content;
      });
    }
    return {
      state,
    };
  },
};
</script>

<style lang="scss" scoped>
.content{
  width: 700px;
  margin: auto;
}  
</style>